﻿@{
    ViewBag.Title = "打印药方";
    Layout = null;
}
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script src="~/Resources/myScript/loadWindow.js"></script>
    <script src="~/Resources/mainFrame/js/jquery.min.js?v=2.1.4"></script>
    <script src="~/Resources/tools/jquery-hcq2-extend.js"></script>
    <style>
        body{
            margin:0;
            padding:0;
        }
        .yearMonth td{
            padding-top:25px;
        }
        .nameCode td{
            padding-top:40px;
        }
    </style>
    <script>
        var  userId, ckDate,hosName;
        var printManager = {
            //打印
            printWindow:function(){
                //window.print();
                bdhtml = window.document.body.innerHTML;
                sprnstr = "<!--startprint-->";
                eprnstr = "<!--endprint-->";
                prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
                prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
                window.document.body.innerHTML = prnhtml;
                window.print();

            },
            //初始化数据
            initData:function(){
                hosName= decodeURI($.getUrls("hosName"));
                userId = $.getUrls("userId");
                ckDate = $.getUrls("ckDate");
                var ck_date = ckDate.split('-');
                $.ajax({
                    url: $.ctx() + '/BaneHospital/GetPrintData',
                    type: "post",
                    async: false,
                    data: { userId: userId },
                    dataType: 'json',
                    success: function (data) {
                        if (data.Statu != 0) {
                            layer.msg(data.Msg, { icon: 5 });
                            return false;
                        }
                        var person=data.Data;
                        $('#hosName').html(hosName);
                        $('#hosYear').text(ck_date[0]);
                        $('#hosMonth').text(ck_date[1]);
                        $('#hosDay').text(ck_date[2]);
                        $('#userName').text(person.user_name);
                        $('#userSex').text(person.user_sex);
                        $('#userAge').text(person.age);
                        $('#hosCode').text(person.hos_code);
                        $('#userIdentify').text(person.user_identify);
                        $('#doseNum').text(person.dose_num);
                    },
                    error: function () {
                        layer.msg('数据异常~', { icon: 5 });
                    }
                });
            }
        }
        $(function () {
            printManager.initData();
        });
    </script>
</head>
<body>
    <!--startprint-->
    <table id="printPerson" border="0" cellpadding="0" cellspacing="0" style='margin:0 auto;width:100%;border-collapse:collapse;table-layout:fixed;'>
        <tr>
            <td colspan="15" style='text-align:left;font-size:18px;font-weight:700;padding-top:20px;padding-left:15px;'><span id="hosName"></span><span></span> </td>
        </tr>
        @*<tr height="26.67" style='height:20.00pt;mso-height-source:userset;mso-height-alt:400;'>
            <td height="26.67" style='height:20.00pt;'></td>
            <td colspan="11" style='border-right:none;border-bottom:none;'></td>
            <td colspan="2" style='border-right:none;border-bottom:none;'>麻、精一</td>
            <td></td>
        </tr>*@
        <tr class="yearMonth">
            <td colspan="2" id="hosYear" style="padding-left:34px;"></td>
            <td colspan="1" id="hosMonth"></td>
            <td colspan="2" id="hosDay"></td>
            <td colspan="10"></td>
        </tr>
        <tr class="nameCode">
            <td id="userName" colspan="5" style="padding-left:100px;"></td>
            <td colspan="2" id="userSex" style="padding-left:20px;"></td>
            <td colspan="1" id="userAge"></td>
            <td colspan="3"></td>
            <td id="hosCode" colspan="5"></td>
        </tr>
        <tr>
            <td colspan="2"></td>
            <td colspan="6"></td>
            <td  id="userIdentify" colspan="7" style="padding-top:18px;padding-left:23px;"></td>
        </tr>
        <tr>
            <td colspan="15" style='font-weight:700;padding-top:72px;'><span style="margin-left:115px;font-size:25px;font-weight:500;">美沙酮口服液 <span id="doseNum" style="margin:0 5px;"></span> ml</span></td>
        </tr>
    </table>
    <!--endprint-->
</body>
</html>

